<?php
class Custom_External
{
    /**
     * @param type $length
     * @return string 
     */
    static function generateRandomString($length=10) 
    {
        $length = $length;
        $characters = '0123456789abcdefghijklmnopqrstuvwxyz';
        $string = "";

        for ($p = 0; $p < $length; $p++) 
        {
            $string .= $characters[mt_rand(0, strlen($characters))];
        }
        return $string;
    }
    /**
     * @param type $data
     * @return type encoded json  
     */
    static function jsonEncode($data)
    {
        try
        {
            return(Zend_Json_Encoder::encode($data));
        }   
        catch(Exception $e)
        {
            return false;
        }
    }
    /**
     * @param type $data encoded json
     * @return type decoded json
     */
    static function jsonDecode($data)
    {
        try
        {
            return(Zend_Json_Decoder::decode($data));
        }
        catch(Exception $e)
        {
            return false;
        }
        
    }
}


?>